package com.base.core.context.configure;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

import com.gitee.magic.core.utils.SnowflakeIdWorker;

/**
 * @author start 
 */
@Configurable
@ComponentScan(basePackages = {
		"com.base.core.context.core"
		})
public class BootConfigurable {
	
	@Value("${magic.system.balanced_worker_id:0}")
	private long balancedWorkerId;
	@Value("${magic.system.balanced_datacenter_id:0}")
	private long balancedDatacenterId;

	@Bean
	public SnowflakeIdWorker getSnowflakeIdWorker(){
		return new SnowflakeIdWorker(balancedWorkerId,balancedDatacenterId);
	}
	
}
